home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Chat & Communication / Digsby build 37 / digsby_setup.exe / lib / util / proxy_settings.pyo (.txt) < prev    next >
Python Compiled Bytecode  |  2008-10-13  |  2KB  |  53 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. from observe import ObservableDict as SavingDictBase
  5.  
  6. class ProxySavingDict(SavingDictBase):
  7.     
  8.     def __init__(self, save_func, *a, **k):
  9.         self.save_func = save_func
  10.         SavingDictBase.__init__(self, *a, **k)
  11.  
  12.     
  13.     def save(self):
  14.         self.save_func(self)
  15.  
  16.     
  17.     def __setitem__(self, key, val):
  18.         SavingDictBase.__setitem__(self, key, val)
  19.         self.save()
  20.  
  21.     
  22.     def __delitem__(self, key):
  23.         SavingDictBase.__delitem__(self, key)
  24.         self.save()
  25.  
  26.     
  27.     def clear(self):
  28.         SavingDictBase.clear(self)
  29.         self.save()
  30.  
  31.  
  32. __proxy_settings = None
  33.  
  34. def get_proxy_dict():
  35.     global __proxy_settings
  36.     if __proxy_settings is not None:
  37.         return __proxy_settings
  38.     
  39.     import gui.toolbox.toolbox as tb
  40.     ls = tb.local_settings()
  41.     section = 'Proxy Settings'
  42.     if not ls.has_section(section):
  43.         ls.add_section(section)
  44.     
  45.     
  46.     def save(d):
  47.         ls._sections[section] = d.copy()
  48.         ls.save()
  49.  
  50.     __proxy_settings = ProxySavingDict(save, ls.iteritems(section))
  51.     return __proxy_settings
  52.  
  53.